home *** CD-ROM | disk | FTP | other *** search
/ Libris Britannia 4 / science library(b).zip / science library(b) / PROGRAMM / CC_C / 0574.ZIP / RDWR.ASM < prev    next >
Assembly Source File  |  1986-11-20  |  567b  |  39 lines

  1. include compiler.inc
  2.     ttl    RDRW, 1.04, 08-30-86, clr
  3.  
  4. ;low-level interface to DOS
  5.  
  6.     dseg
  7.     exterr
  8.  
  9.     cseg
  10.  
  11.     procdef    read, <<handl, word>, <buffr, ptr>, <count, word>>
  12.     push    di
  13.     mov    di,3f00h    ;save read function value
  14.     jmp    short start
  15.  
  16.     entrdef    write
  17.     push    di
  18.     mov    di,4000h    ;save write function value
  19.  
  20. start:
  21.     xor    ax,ax
  22.     moverr    ax        ;blank _errcod first
  23.     mov    bx,handl    ; handle
  24.     pushds
  25.     ldptr    dx,buffr,ds    ; buffer
  26.     mov    cx,count    ; count
  27.     mov    ax,di
  28.     int    21h
  29.     popds
  30.     jnc    fini
  31.     moverr    ax
  32.     mov    ax,-1
  33. fini:
  34.     pop    di
  35.     pret
  36.     pend    read
  37.  
  38.     finish
  39.